package com.frogs.ucenter.v1.request;

import javax.servlet.http.HttpServletRequest;

import com.alibaba.fastjson.JSONArray;
import com.frogs.framework.util.StringUtil;
import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.util.ApplicablePlatformEnum;
import com.frogs.system.util.UserMessageTypeEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

public class DirectMessageReadRequest extends Request {
	
	private static final long serialVersionUID = -8060071208854567695L;
	
	private Integer applicableId;
	
	private String ids;
	
	private String receiverId;
	
	private String ip;
	
	private String level;
	
	public String getLevel() {
		return level;
	}

	public void setLevel(String level) {
		this.level = level;
	}

	/** */
	public DirectMessageReadRequest() {
	}
	
	@Override
	public void parse(HttpServletRequest request) {
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		
		this.applicableId = requestInfo.getIntParameter(ApiUrlParamEnum.applicablePlatformId.getParamName(), ApplicablePlatformEnum.WEB.getId());
		this.ids = requestInfo.getParameter(ApiUrlParamEnum.ids.getParamName());
		this.receiverId = requestInfo.getParameter(ApiUrlParamEnum.receiverIds.getParamName());
		this.ip = requestInfo.getParameter(ApiUrlParamEnum.ip.getParamName(), requestInfo.getUserIp());
		this.level = requestInfo.getParameter(ApiUrlParamEnum.level.getParamName());
		
		if ( StringUtil.isEmpty(ids) ) {
			throw new RequestIllegalException("消息ID不能为空 ");
		}
		
		if(StringUtil.isEmpty(receiverId)) {
			throw new RequestIllegalException("收件人ID不能为空");
		}
	}

	public Integer getApplicableId() {
		return applicableId;
	}

	public void setApplicableId(Integer applicableId) {
		this.applicableId = applicableId;
	}

	public String getIds() {
		return ids;
	}

	public void setIds(String ids) {
		this.ids = ids;
	}

	public String getReceiverId() {
		return receiverId;
	}

	public void setReceiverId(String receiverId) {
		this.receiverId = receiverId;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}
}
